﻿using BestTrader.Cms.ViewModels;
using FluentValidation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace BestTrader.Cms.UserCenter.Validation
{
    public class PasswordModelValidation : AbstractValidator<PasswordModel>
    {
        public PasswordModelValidation()
        {
            RuleFor(x => x.UserName).NotNull().WithMessage("用户名不能为空");
            RuleFor(x => x.Password).Length(6, 12).WithMessage("旧密码必须6到12位，且不能出现空格");
            RuleFor(x => x.NewPassword).Length(6, 12).WithMessage("新密码必须6到12位，且不能出现空格");
            RuleFor(x => x.Password).NotEqual(x => x.NewPassword).WithMessage("两次录入的密码不一样");
        }
    }
}
